using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace Widgetsphere.Core.DataAccess
{
	public abstract partial class BusinessObjectBase
	{
		/// <summary>
		/// Get the validation rule violations
		/// </summary>
		/// <returns></returns>
		public virtual IEnumerable<IRuleViolation> GetRuleViolations()
		{
			List<IRuleViolation> retval = new List<IRuleViolation>();
			return retval;
		}

		/// <summary>
		/// Determines if all of the validation rules have been met
		/// </summary>
		/// <returns></returns>
		public virtual bool IsValid()
		{
			return (GetRuleViolations().Count() == 0);
		}

		public abstract bool IsEquivalent(IBusinessObject item);

		/// <summary>
		/// This event is raised when any field is changed.
		/// </summary>
		public virtual event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

		/// <summary>
		/// This event is raised when any field is changed.
		/// </summary>
		protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
		{
			if (this.PropertyChanged != null)
				this.PropertyChanged(this, e);
		}

	}
}